import cv2
import numpy as np

# 读取图片
image = cv2.imread('orig_frame_3.jpg', cv2.IMREAD_GRAYSCALE)

# 边缘检测
edges = cv2.Canny(image, 10, 30)

# 标出边缘
image_with_edges = np.copy(image)
image_with_edges[edges != 0] = 0  # 将边缘部分设置为黑色

# 显示结果
cv2.imshow('Original Image', image)
cv2.imshow('Edges', edges)
cv2.imshow('Image with Edges', image_with_edges)
cv2.waitKey(0)
cv2.destroyAllWindows()